package base.patterns.command;

import base.patterns.delegate.Delegate;
import base.patterns.delegate.Delegate.Slot;

public class Command<Data> {
	private Data commandData;
	
	private final Delegate<Void, Data> handler = new Delegate<Void, Data>();
	
	public Command(Slot<Void, Data> slot, Data data){
		commandData = data;
		Delegate.connect(this.handler, slot);
	}
	
	public void execute(){
		handler.call(commandData);
	}

	public boolean isInit() {
		return null != commandData;
	}
}
